package flexexamples.domain
{
	import mx.collections.ArrayCollection;
	
	[Bindable]
	[RemoteClass(alias="flexexamples.domain.Iteration")]
	public class Iteration
	{
		public var id:int;
		public var project:Project;
		
		[ArrayElementType("flexexamples.domain.UserStory")]
		public var userStories:ArrayCollection = new ArrayCollection();
		
		public function addUserStory(story:UserStory) : void
		{
			userStories.addItem(story);
		}
		
		public function getNumberOfPoints() : int
		{
			var points:int = 0;
			for each(var story:UserStory in userStories){
				points += story.estimate;
			}
			return points;
		}
	}
}